import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpContact {
  id!: number;
  isMp: boolean = true;
  mpTitle?: string;
  mpArr?: unknown;
  isUrl: boolean = false;
  urlTitle?: string;
  urlUrl?: unknown;
  urlArr?: unknown;
  isTel: boolean = false;
  telTitle?: string;
  telNumber?: string;
  telArr?: unknown;
  uniacid!: number;
}

export const ImsYzdKpContactSchema = new EntitySchema({
  class: ImsYzdKpContact,
  properties: {
    id: { primary: true, type: 'number' },
    isMp: { type: 'boolean', default: true },
    mpTitle: { type: 'string', length: 255, nullable: true },
    mpArr: { type: 'unknown', columnType: 'longtext', nullable: true },
    isUrl: { type: 'boolean', default: false },
    urlTitle: { type: 'string', length: 255, nullable: true },
    urlUrl: { type: 'unknown', columnType: 'longtext', nullable: true },
    urlArr: { type: 'unknown', columnType: 'longtext', nullable: true },
    isTel: { type: 'boolean', default: false },
    telTitle: { type: 'string', length: 255, nullable: true },
    telNumber: { type: 'string', length: 255, nullable: true },
    telArr: { type: 'unknown', columnType: 'longtext', nullable: true },
    uniacid: { type: 'number', index: 'uniacid' },
  },
});
